<?php

/**
 * Hammer and Nails Software
 * Copyright (c) 2006-2007 Hammer and Nails Software. (http://www.hansoft.org)
 *
 * LICENSE
 *
 * This source file is subject to the GNU General Public License v3 license 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.hansoft.org/licenses/gpl-3.0.txt or through the GNU website:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@hansoft.org so we can send you a copy immediately.
 *
 * @copyright  (c) 2006-2007 Hammer and Nails Software. (http://www.hansoft.org)
 * @license    http://www.hansoft.org/licenses/gpl-3.0.txt
 * @version    $Id: Action.php 5 2008-02-11 17:25:01Z artiskool $
 */

class Hansoft_Controller_Action extends Zend_Controller_Action
{
    public function preDispatch()
    {
		
        $view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
		$auth = Zend_Auth::getInstance();
		if ($view->authenticated = $auth->hasIdentity())
		{
			$view->username = $auth->getIdentity()->username;
		}
		else
		{
			$view->username = 'guest';
		}		

		$config = Zend_Registry::get('config');
		$view->pageTitle = $config->pagetitle;//"My Page Title";

        $view->baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
    }

    public function __call($name, $args)
    {
        throw new Exception('Sorry, the requested action does not exist');
    }
}
